<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/8/20
  Time: 20:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>购物车</title>
</head>
<script>
    function deleteCarGoods(id) {
        window.location.href="${pageContext.request.contextPath}/goods/removeCarGoods?id="+id;
    }

    function toAccount(totalMoney) {
        window.location.href="${pageContext.request.contextPath}/goods/toAccount?totalMoney="+totalMoney;
    }
</script>
<body>
    <div style="text-align: center">
        <h1>购物车</h1>
        <hr>
        <table>
            <tr>
                <td>商品名称</td>
                <td>商品标题</td>
                <td>商品类型</td>
                <td>商品描述</td>
                <td>商品价格</td>
            </tr>
            <c:forEach items="${shoppingCar}" var="goods">
                <tr>
                    <td>${goods.name}</td>
                    <td>${goods.title}</td>
                    <td>${goods.goodsType.name}</td>
                    <td>${goods.describe}</td>
                    <td>$ ${goods.price} 元</td>
                    <td><a href="#" onclick="deleteCarGoods(${goods.id})">移出购物车</a></td>
                </tr>
            </c:forEach>
        </table>
        总计：￥ ${totalMoney} 元

        <input type="button" onclick="toAccount(${totalMoney})" value="去付款">
    </div>
</body>
</html>
